import Vue from 'vue'
import VueRouter from 'vue-router'
// import axios from 'axios'
// import { Message } from 'element-ui'
// import { getUrl } from '../utils/getUrl.js'
// import { getMyCookie } from '../utils/myCookie.js'
// import NProgress from 'nprogress' // 导入进度条
import Login from '../views/login.vue'
import Home from '../components/Home.vue'
import Welcome from '../components/Welcome.vue' // 首页
import Excels from '../components/Mains/Excels.vue' // 测试1
import sc from '../components/Mains/c.vue' // 测试2
import MainBoardEdit from '../components/mainboard/mainboard' // 主板配置首页
import Auto from '../components/mainboard/Auto.vue' // 通用
import Network from '../components/mainboard/Network.vue' // 网络配置
import Role from '../components/mainboard/Role.vue' // 通道
import Main from '../components/mainboard/Main.vue' // 主板
import AutoOne from '../components/Autos/AutoOne.vue' // 信息
import AutoTwo from '../components/Autos/AutoTwo.vue' // 实时信息
import Reported from '../components/mainboard/Reported.vue' // 上报
import Problem from '../components/Business/Problem/Problem.vue' // 问题管理
import ProblemList from '../components/Business/Problem/ProblemList.vue' // 问题管理列表
import Whitelist from '../components/Business/Problem/Whitelist.vue' // 问题管理白名单
import ProblemNotice from '../components/Business/Problem/ProblemNotice.vue' // 问题管理列表
import FaultManage from '../components/Business/FaultManage.vue' // 故障管理
import FaultList from '../components/Business/FaultList.vue' // 故障列表
import WorkOrderManage from '../components/Business/WorkOrderManage.vue' // 工单管理
import WorkDictionaries from '../components/Business/components/WorkOrderDictionaries.vue' // 工单列表
import WorkOrderList from '../components/Business/components/WorkOrderList.vue' // 工单字典
import RoleManage from '../components/Roles/RoleManage.vue' // 角色管理
import AddRole from '../components/Roles/AddRole.vue' // 添加角色
import Roles from '../components/Roles/Roles.vue' // 角色
import RolePermissions from '../components/Roles/RolePermissions.vue' // 角色权限
import Property from '../components/property/property.vue' // 资产
import Addproperty from '../components/property/Addproperty.vue' // 添加资产管理
import PropertyList from '../components/property/propertyList.vue' // 资产列表
import PropertyGrouping from '../components/property/propertyGrouping.vue' // 资产分组
import PropertyScrap from '../components/property/propertyScrap.vue' // 资产报废
import Dictionaries from '../components/property/dictionaries.vue' // 资产字典
import BrandDictionary from '../components/property/brandDictionary.vue' // 品牌字典
import NotStock from '../components/property/notStock.vue' // 未入库
import DetailsGrouping from '../components/property/detailsGrouping.vue' // 资产分组详情
import Platform from '../components/platform/platform.vue' // 平台
import UserList from '../components/platform/userList.vue' // 用户列表
import UserDictionaries from '../components/platform/userDictionaries.vue' // 字典
import UserAppPage from '../components/platform/userAppPage.vue' // app
import Organization from '../components/Organization/Organization.vue' // 组织机构管理
import OrganizationList from '../components/Organization/organizationList.vue' // 组织机构列表
import OrganizationDictionary from '../components/Organization/organizationDictionary.vue' // 组织机构列表
// import Contract from '../components/Contract/Contract.vue' // 合同管理
import Contract from '../components/Contract/index.vue' // 合同管理
import ContractManage from '../components/Contract/ContractManage.vue' // 合同管理列表
import AddContract from '../components/Contract/AddContract.vue' // 录入合同
import EditContract from '../components/Contract/EditContract.vue' // 编辑合同
import Bayonet from '../components/Bayonet/bayonet.vue' // 卡口
import BayonetList from '../components/Bayonet/bayonetList.vue' // 卡口列表
import ElectronicPolice from '../components/Bayonet/electronicPolice.vue' // 卡口电子警察
import ElectronicPoliceDictionary from '../components/Bayonet/electronicPoliceDictionary.vue' // 卡口电子警察字典
import Addbayonet from '../components/Bayonet/addbayonet.vue' // 添加卡口
import AddElectronicPolice from '../components/Bayonet/addElectronicPolice.vue' // 添加电子警察
import UserCore from '../components/UserCore/index.vue' // 个人中心
import PasswordJJ from '../components/UserCore/passwordJJ.vue' // 密码认证
import MailResult from '../components/UserCore/mailResult.vue' // 邮箱认证返回结果
import Journal from '../components/Journal/index.vue' // 业务日志
import JournalList from '../components/Journal/list.vue' // 业务日志列表
import FaultDictionary from '../components/FaultDictionary/index.vue' // 问题故障字典
import FaultDictionaryList from '../components/FaultDictionary/faultDictionaryList.vue' // 问题故障字典-列表
import AddJournal from '../components/Journal/addJournal.vue' // 添加日志
import RunTesting from '../components/RunTesting/index.vue' // 运行检测
import FaultSnapshot from '../components/RunTesting/faultSnapshot.vue' // 故障快照
import Videotape from '../components/RunTesting/videotape.vue' // 录像状况
import CaptureSB from '../components/RunTesting/captureSB.vue' // 抓拍设备检测
import QwHost from '../components/RunTesting/qwHost.vue' // 前卫主机
import CaptureQuality from '../components/RunTesting/captureQuality.vue' // 拍摄质量诊断
import LatelySB from '../components/RunTesting/latelySB.vue' // 最近一小时上下线设备
import SysTesting from '../components/SysTesting/index.vue' // 系统巡检单
import MachineInspection from '../components/SysTesting/machineInspection.vue' // 系统巡检单
import SystemInspection from '../components/SysTesting/systemInspection.vue' // 系统巡检单
import InspectionDefect from '../components/SysTesting/inspectionDefect.vue' // 系统巡检单
import AddMachineInspection from '../components/SysTesting/addMachineInspection.vue'
import AddSystemInspectiAon from '../components/SysTesting/addSystemInspection.vue'
import HostRecord from '../components/networkAccess/index.vue' // 主机备案管理
import NetworkAccessList from '../components/networkAccess/networkAccessList.vue' // 主机备案列表
import KeepOnRecord from '../components/networkAccess/keepOnRecord.vue' // 资产登记
import AccessBlacklist from '../components/networkAccess/accessBlacklist.vue' // 主机备案黑名单
import AddNetworks from '../components/networkAccess/addNetworks.vue' // 添加备案
import ComputerRoom from '../components/computerRoom/index.vue' // 机房管理
import ComputerRoomList from '../components/computerRoom/list.vue' // 机房管理
import Mainboard from '../components/mainboard/index.vue' // 前卫主机配置界面
import MainboardList from '../components/mainboard/mainboardList.vue' // 前卫主机配置界面-列表
import Monitor from '../components/Comprehensive/monitor/index.vue' //  运维概况
import OverviewPage from '../components/Comprehensive/monitor/OverviewPage.vue' //  资产概况
import DistributionPreview from '../components/Comprehensive/monitor/DistributionPreview.vue' //  分布概览
import DynamicEnvironment from '../components/Comprehensive/monitor/DynamicEnvironment.vue' // 业务概览
import UserTrack from '../components/Comprehensive/monitor/userTrack.vue' // 用户轨迹
import DonlihjOverview from '../components/Comprehensive/monitor/donlihjOverview.vue' // 机房动力环境
import ServerOverview from '../components/Comprehensive/monitor/serverOverview.vue' //  云资源列表界面
import CloudDetails from '../components/Comprehensive/monitor/cloudDetails.vue' //  云资源详情界面
import CpuPage from '../components/Comprehensive/monitor/components/cpuPage' //  云资源详情界面-cpu
import Memory from '../components/Comprehensive/monitor/components/memory' //  云资源详情界面-内存
import NetworkFlow from '../components/Comprehensive/monitor/components/networkFlow' //  云资源详情界面-网络
import HardDisk from '../components/Comprehensive/monitor/components/hardDisk' //  云资源详情界面-硬盘
import Survey from '../components/Comprehensive/survey/index.vue' //  运维监视
import SurveyList from '../components/Comprehensive/survey/surveyList.vue' //  运维监视列表
import Hostview from '../components/Comprehensive/hostview/index.vue' //  监控点位
import HostviewList from '../components/Comprehensive/hostview/hostviewList.vue' //  监控点位
import WorkOrderReport from '../components/BusinessReport/WorkOrderReport/index.vue' //  工单报表
import WorkOrderReportList from '../components/BusinessReport/WorkOrderReport/workOrderReportList.vue' //  工单报表-列表
import FaultReport from '../components/BusinessReport/FaultReport/index.vue' //  故障报表
import FaultReportList from '../components/BusinessReport/FaultReport/faultReportList.vue' //  故障报表-列表
import AssetStatement from '../components/BusinessReport/AssetStatement/index.vue' //  资产报表
import TonJiList from '../components/BusinessReport/AssetStatement/tonjiList.vue' //  资产统计列表
import BaoFeiList from '../components/BusinessReport/AssetStatement/baofeiList.vue' //  报废资产统计
import PpList from '../components/BusinessReport/AssetStatement/ppList.vue' //  资产品牌统计
import atuoMap from '@/components/mainboard/autoMap.vue' //  资产报表
import Parameter from '@/components/Parameter/index.vue' // 参数配置
import IotParameter from '@/components/Parameter/iotParameter.vue' // IoT配置
import Txpz from '@/components/Parameter/txpz.vue' // 系统通讯配置
import ProblemKickOut from '@/components/Parameter/problemKickOut.vue' // 问题剔除配置
import CommunicationProblems from '@/components/Parameter/tabs/txwt.vue' // 通讯问题
import EquipmentOntology from '@/components/Parameter/tabs/sbbtwt.vue' // 设备本体问题
import DynamicRingProblem from '@/components/Parameter/tabs/jfdhwt.vue' // 机房动环问题
import VoltageCurrent from '@/components/Parameter/voltageCurrent.vue' // 设备电压电流
import EditVoltageCurrent from '@/components/Parameter/editVoltageCurrent.vue' // 录入/编辑电压电流
import AlarmIndex from '@/components/alarmModule/index.vue' // 报警配置tab
import AlarmConfig from '@/components/Parameter/alarmConfig.vue' // 报警配置
import AlarmLog from '../components/Journal/alarmLog.vue' // 报警日志
import MenuManagement from '@/components/menuManagement/index.vue' // 菜单管理
import MenuList from '@/components/menuManagement/menuList.vue' // 菜单配置
import AddMenu from '@/components/menuManagement/addMenu.vue' // 添加/编辑菜单
import EditorBox from '@/components/knowledge/editorBox.vue' // 发布/富文本编辑

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'login',
    component: Login
  },
  // 个人中心密码验证
  {
    path: '/passwordJJ',
    name: 'passwordJJ',
    component: PasswordJJ
  },
  // 邮箱验证返回结果界面
  {
    path: '/mailResult',
    name: 'mailResult',
    component: MailResult
  },
  {
    path: '/atuoMap',
    name: 'atuoMap',
    component: atuoMap
  },
  {
    path: '/home',
    name: 'home',
    component: Home,
    redirect: '/welcome',
    children: [
      {
        path: '/welcome',
        name: 'welcome',
        component: Welcome
      },
      // 资产管理
      {
        path: '/property',
        name: 'property',
        component: Property,
        // redirect: '/propertyList',
        children: [
          {
            path: '/propertyList',
            name: 'propertyList',
            component: PropertyList
          },
          {
            path: '/propertyGrouping',
            name: 'propertyGrouping',
            component: PropertyGrouping
          },
          {
            path: '/propertyScrap',
            name: 'propertyScrap',
            component: PropertyScrap
          },
          {
            path: '/dictionaries',
            name: 'dictionaries',
            component: Dictionaries
          },
          {
            path: '/brandDictionary',
            name: 'brandDictionary',
            component: BrandDictionary
          },
          {
            path: '/notStock',
            name: 'notStock',
            component: NotStock
          }
        ]
      },
      // 用户管理
      {
        path: '/platform',
        name: 'platform',
        component: Platform,
        // redirect: '/userList',
        children: [
          {
            path: '/userList',
            name: 'userList',
            component: UserList
          },
          {
            path: '/userDictionaries',
            name: 'userDictionaries',
            component: UserDictionaries
          },
          {
            path: '/userAppPage',
            name: 'userAppPage',
            component: UserAppPage
          }
        ]
      },
      {
        path: '/excel',
        name: 'excel',
        component: Excels
      },
      {
        path: '/sc',
        name: 'sc',
        component: sc
      },
      {
        path: '/editorBox',
        name: 'editorBox',
        component: EditorBox
      },
      // 个人中心
      {
        path: '/userCore',
        name: 'userCore',
        component: UserCore
      },
      // 添加资产
      {
        path: '/Addproperty',
        name: 'Addproperty',
        component: Addproperty
      },
      // 资产分组详情
      {
        path: '/detailsGrouping',
        name: 'detailsGrouping',
        component: DetailsGrouping
      },
      {
        path: '/addbayonet',
        name: 'Addbayonet',
        component: Addbayonet
      },
      // 添加电子警察
      {
        path: '/addElectronicPolice',
        name: 'addElectronicPolice',
        component: AddElectronicPolice
      },
      // 角色
      {
        path: '/addRole',
        name: 'addRole',
        component: AddRole
      },
      // 问题管理
      {
        path: '/problem',
        name: 'problem',
        component: Problem,
        // redirect: '/problemList',
        children: [
          {
            path: '/problemList',
            name: 'problemList',
            component: ProblemList
          },
          {
            path: '/whitelist',
            name: 'whitelist',
            component: Whitelist
          },
          {
            path: '/problemNotice',
            name: 'problemNotice',
            component: ProblemNotice
          }
        ]
      },
      // 故障管理
      {
        path: '/FaultManage',
        name: 'FaultManage',
        component: FaultManage,
        children: [
          {
            path: '/faultList',
            name: 'faultList',
            component: FaultList
          }
        ]
      },
      // 工单管理
      {
        path: '/workOrderManage',
        name: 'workOrderManage',
        component: WorkOrderManage,
        // redirect: '/workOrderList',
        children: [
          {
            path: '/workOrderList',
            name: 'workOrderList',
            component: WorkOrderList
          },
          {
            path: '/workDictionaries',
            name: 'workDictionaries',
            component: WorkDictionaries
          }
        ]
      },
      // 业务日志
      {
        path: '/journal',
        name: 'journal',
        component: Journal,
        children: [
          {
            path: '/journalList',
            name: 'journalList',
            component: JournalList
          }
          // {
          //   // 报警日志
          //   path: '/alarmLog',
          //   name: 'alarmLog',
          //   component: AlarmLog
          // }
        ]
      },
      // 添加日志
      {
        path: '/addJournal',
        name: 'addJournal',
        component: AddJournal
      },
      // 问题故障字典
      {
        path: '/faultDictionary',
        name: 'faultDictionary',
        component: FaultDictionary,
        children: [
          {
            path: '/faultDictionaryList',
            name: 'faultDictionaryList',
            component: FaultDictionaryList
          }
        ]
      },
      // 角色
      {
        path: '/roles',
        name: 'roles',
        component: Roles,
        // redirect: '/roleManage',
        children: [
          {
            path: '/roleManage',
            name: 'roleManage',
            component: RoleManage
          },
          {
            path: '/rolePermissions',
            name: 'rolePermissions',
            component: RolePermissions
          }
        ]
      },
      // 组织机构
      {
        path: '/organization',
        name: 'organization',
        component: Organization,
        // redirect: '/organizationList',
        children: [
          {
            path: '/organizationList',
            name: 'organizationList',
            component: OrganizationList
          },
          {
            path: '/organizationDictionary',
            name: 'organizationDictionary',
            component: OrganizationDictionary
          }
        ]
      },
      // 合同
      {
        path: '/contract',
        name: 'contract',
        component: Contract,
        redirect: '/contractManage',
        children: [
          {
            path: '/contractManage',
            name: 'contractManage',
            component: ContractManage
          },
          {
            path: '/addContract',
            name: 'addContract',
            component: AddContract
          },
          {
            path: '/editContract',
            name: 'editContract',
            component: EditContract
          }
        ]
      },
      // 主机配置
      {
        path: '/mainboard',
        name: 'mainboard',
        component: Mainboard,
        children: [
          {
            path: '/mainboardList',
            name: 'mainboardList',
            component: MainboardList
          }
        ]
      },
      {
        path: '/mainBoarEdit',
        name: 'mainboaredit',
        component: MainBoardEdit,
        redirect: '/main',
        children: [
          // {
          //   path: '/network',
          //   name: 'network',
          //   component: Network
          // },

          {
            path: '/auto',
            name: 'auto',
            component: Auto,
            redirect: '/auto/one',
            children: [
              {
                path: '/auto/one',
                name: 'autoOne',
                component: AutoOne
              },
              {
                path: '/auto/two',
                name: 'autoTwo',
                component: AutoTwo
              }
            ]
          },
          {
            path: '/network',
            name: 'network',
            component: Network
          },
          {
            path: '/role',
            name: 'role',
            component: Role
          },
          {
            path: '/main',
            name: 'main',
            component: Main
          },
          {
            path: '/reported',
            name: 'reported',
            component: Reported
          }
        ]
      },
      // 卡口
      {
        path: '/bayonet',
        name: 'bayonet',
        component: Bayonet,
        // redirect: '/bayonetList',
        children: [
          {
            path: '/bayonetList',
            name: 'bayonetList',
            component: BayonetList
          },
          {
            path: '/electronicPolice',
            name: 'electronicPolice',
            component: ElectronicPolice
          },
          {
            path: '/electronicDictionary',
            name: 'electronicDictionary',
            component: ElectronicPoliceDictionary
          }
        ]
      },
      // 运行检测
      {
        path: '/runTesting',
        name: 'runTesting',
        component: RunTesting,
        // redirect: '/faultSnapshot',
        children: [
          {
            path: '/faultSnapshot',
            name: 'faultSnapshot',
            component: FaultSnapshot
          },
          {
            path: '/videotape',
            name: 'videotape',
            component: Videotape
          },
          {
            path: '/captureSB',
            name: 'captureSB',
            component: CaptureSB
          },
          {
            path: '/qwHost',
            name: 'qwHost',
            component: QwHost
          },
          {
            path: '/captureQuality',
            name: 'captureQuality',
            component: CaptureQuality
          },
          {
            path: '/latelySB',
            name: 'latelySB',
            component: LatelySB
          },
          {
            path: '/donlihjOverview',
            name: 'donlihjOverview',
            component: DonlihjOverview
          },
          {
            path: '/serverOverview',
            name: 'serverOverview',
            component: ServerOverview
          }
        ]
      },
      // 云资源详情
      {
        path: '/cloudDetails',
        name: 'cloudDetails',
        component: CloudDetails,
        children: [
          {
            // cpu
            path: '/cpuPage',
            name: 'cpuPage',
            component: CpuPage
          },
          {
            // 内存
            path: '/memory',
            name: 'memory',
            component: Memory
          },
          {
            // 网络
            path: '/networkFlow',
            name: 'networkFlow',
            component: NetworkFlow
          },
          {
            // 硬盘
            path: '/hardDisk',
            name: 'hardDisk',
            component: HardDisk
          }
        ]
      },
      // 录入机房巡检单
      {
        path: '/addMachineInspection',
        name: 'addMachineInspection',
        component: AddMachineInspection
      },
      // 录入系统巡检单
      {
        path: '/addSystemInspection',
        name: 'addSystemInspection',
        component: AddSystemInspectiAon
      },
      // 系统巡检单
      {
        path: '/sysTesting',
        name: 'sysTesting',
        component: SysTesting,
        children: [
          {
            path: '/machineInspection',
            name: 'machineInspection',
            component: MachineInspection
          },
          {
            path: '/systemInspection',
            name: 'systemInspection',
            component: SystemInspection
          },
          {
            path: '/inspectionDefect',
            name: 'inspectionDefect',
            component: InspectionDefect
          }
        ]
      },
      // 录入主机备案
      {
        path: '/addNetworks',
        name: 'addNetworks',
        component: AddNetworks
      },
      // 资产登记
      {
        path: '/keepOnRecord',
        name: 'keepOnRecord',
        component: KeepOnRecord
        // component: resolve => require(['@/components/networkAccess/keepOnRecord.vue'], resolve)
      },
      // 主机备案管理
      {
        path: '/hostRecord',
        name: 'hostRecord',
        component: HostRecord,
        children: [
          {
            path: '/networkAccessList',
            name: 'networkAccessList',
            component: NetworkAccessList
          },
          {
            path: '/accessBlacklist',
            name: 'accessBlacklist',
            component: AccessBlacklist
          }
        ]
      },
      // 机房管理
      {
        path: '/computerRoom',
        name: 'computerRoom',
        component: ComputerRoom,
        children: [
          {
            path: '/computerRoomList',
            name: 'computerRoomList',
            component: ComputerRoomList
          }
          // {
          //   path: '/accessBlacklist',
          //   component: AccessBlacklist
          // }
        ]
      },
      // 系统巡检单
      {
        path: '/monitor',
        name: 'monitor',
        component: Monitor,
        children: [
          {
            path: '/overviewPage',
            name: 'overviewPage',
            component: OverviewPage
          },
          {
            // 分布概览
            path: '/distributionPreview',
            name: 'distributionPreview',
            component: DistributionPreview
          },
          {
            // 业务概览
            path: '/dynamicEnvironment',
            name: 'dynamicEnvironment',
            component: DynamicEnvironment
          },
          {
            // 用户轨迹
            path: '/userTrack',
            name: 'userTrack',
            component: UserTrack
          }
        ]
      },
      // 录入/编辑电压电流
      {
        path: '/editVoltageCurrent',
        name: 'editVoltageCurrent',
        component: EditVoltageCurrent
      },
      {
        // 运行监视
        path: '/survey',
        name: 'survey',
        component: Survey,
        children: [
          {
            path: '/surveyList',
            name: 'surveyList',
            component: SurveyList
          }
        ]
      },
      {
        // 监控点位
        path: '/hostview',
        name: 'hostview',
        component: Hostview,
        children: [
          {
            path: '/hostviewList',
            name: 'hostviewList',
            component: HostviewList
          }
        ]
      },
      {
        path: '/workOrderReport',
        name: 'workOrderReport',
        component: WorkOrderReport,
        children: [
          {
            path: '/workOrderReportList',
            name: 'workOrderReportList',
            component: WorkOrderReportList
          }
        ]
      },
      {
        path: '/faultReport', // 故障报表
        name: 'faultReport',
        component: FaultReport,
        children: [
          {
            path: '/faultReportList',
            name: 'faultReportList',
            component: FaultReportList
          }
        ]
      },
      {
        path: '/assetStatement',
        component: AssetStatement,
        children: [
          {
            path: '/tonJiList',
            name: 'tonJiList',
            component: TonJiList
          },
          {
            path: '/baoFeiList',
            name: 'baoFeiList',
            component: BaoFeiList
          },
          {
            path: '/PPList',
            name: 'PPList',
            component: PpList
          }
        ]
      },
      // 参数配置
      {
        path: '/parameter',
        name: 'parameter',
        component: Parameter,
        children: [
          {
            path: '/iotParameter',
            name: 'iotParameter',
            component: IotParameter
          },
          {
            path: '/txpz',
            name: 'txpz',
            component: Txpz
          },
          {
            path: '/problemKickOut',
            name: 'problemKickOut',
            component: ProblemKickOut,
            children: [
              {
                // 通信问题
                path: '/communicationProblems',
                name: 'communicationProblems',
                component: CommunicationProblems
              },
              {
                // 设备本体问题
                path: '/equipmentOntology',
                name: 'equipmentOntology',
                component: EquipmentOntology
              },
              {
                // 机房动环问题
                path: '/dynamicRingProblem',
                name: 'dynamicRingProblem',
                component: DynamicRingProblem
              }
            ]
          },
          {
            path: '/voltageCurrent',
            name: 'voltageCurrent',
            component: VoltageCurrent
          }
          // {
          //   path: '/alarmConfig',
          //   name: 'alarmConfig',
          //   component: AlarmConfig
          // }
        ]
      },
      // 菜单管理
      {
        path: '/menuManagement',
        name: 'menuManagement',
        component: MenuManagement,
        children: [
          {
            path: '/menuList',
            name: 'menuList',
            component: MenuList
          }
        ]
      },
      // 新增菜单/编辑菜单
      {
        path: '/addMenu',
        name: 'addMenu',
        component: AddMenu
      },
      // 报警配置
      {
        path: '/alarmIndex',
        name: 'alarmIndex',
        component: AlarmIndex,
        children: [
          {
            // 报警配置
            path: '/alarmConfig',
            name: 'alarmConfig',
            component: AlarmConfig
          },
          {
            // 报警日志
            path: '/alarmLog',
            name: 'alarmLog',
            component: AlarmLog
          }
        ]
      }
    ]
  }
]

const router = new VueRouter({
  routes
})
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
  return originalPush.call(this, location).catch(err => err)
}
// const urlss = 'http://192.168.1.159:4008/ptpz/yonghu/checkToken'
// const la = async next => {
//   const user = JSON.parse(getUrl('userconter')) || ''
//   const params = new URLSearchParams()
//   params.append('userId', user.id || '')
//   const { data: res } = await axios.post(urlss, params)
//   if (res.code !== '0000') {
//     Message({
//       type: 'error',
//       message: res.message,
//       center: true
//     })
//     return next('/login')
//   }
//   return next
// }
// 路由守卫，页面跳转的触发
router.beforeEach((to, from, next) => {
  if (to) {
    // NProgress.start()
    if (to.path === '/login') {
      return next()
    }
    // 对个人中心进行判断
    if (to.path === '/mailGengai') return next('/passwordJJ')
    if (to.path === '/phoneGengai') return next('/passwordJJ')
    if (to.path === '/MMGengai') return next('/passwordJJ')
    // 业务日志拦截跳转
    if (to.path === '/journal') return next('/JournalList')
  }
  // 登录拦截
  // console.log(getUrl('X-Cmmop-User-Token'))
  // const tokenStr = getUrl('X-Cmmop-User-Token')
  // // const tokenStr = getMyCookie('X-Cmmop-User-Token')
  // // 对tokenStr进行判断，如果登入了就进入home页面，没就就强制跳转到登入页面
  // if (!tokenStr || !window.localStorage.getItem('userName')) return next('/login')
  return next()
})

// router.afterEach((to, from) => {
//   // 结束进度条
//   NProgress.done()
// })
export default router
